﻿using System;
using System.Collections.Generic;
using System.Text;
using DotNet.Data;
using DotNet.Model;
using System.Data;

namespace DotNet.Business
{
    public class UserBll
    {
        UserDal uDal = new UserDal();
        #region 是否存在该记录
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int userID)
        {
            return uDal.Exists(userID);
        }
        #endregion

        #region 用户登录---郑同飞
        /// <summary>
        /// 用户登录---郑同飞
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="userPwd"></param>
        /// <returns></returns>
        public bool Login(string userName,string userPwd) 
        {
            return uDal.Login(userName, userPwd);
        }          
        #endregion

        #region 根据用户名和密码获取实体---郑同飞
        /// <summary>
        /// 根据用户名和密码获取实体---郑同飞
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="userPwd"></param>
        /// <returns></returns>
        public User GetModel(string userName,string userPwd) 
        {
           return uDal.GetModel(userName, userPwd);
        }
        #endregion

        #region 获得用户信息数据列表
        /// <summary>
        /// 获得用户信息数据列表
        /// </summary>
        /// <returns></returns>
        public IList<User> GetModel()
        {
            return uDal.GetModel();
        }
        #endregion

        #region 根据用户信息号查询实体
        /// <summary>
        /// 根据用户信息号查询实体
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public User GetModel(int userID)
        {
            return uDal.GetModel(userID);

        }
        #endregion

        #region 根据用户名查询实体
        /// <summary>
        /// 根据用户名查询实体
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public User GetModel(string  userName)
        {
            return uDal.GetModel(userName);
        }
        #endregion

        #region 修改用户信息
        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="User"></param>
        /// <returns></returns>
        public bool Update(User User)
        {
            return uDal.Update(User);
        }
        #endregion

        #region 删除用户信息根据用户信息号
        /// <summary>
        /// 删除用户信息根据用户信息号
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public bool Delete(int userID)
        {
            return uDal.Delete(userID);
        }
        #endregion

        #region 添加用户信息
        /// <summary>
        /// 添加用户信息
        /// </summary>
        /// <param name="User"></param>
        /// <returns></returns>
        public bool Insert(User User)
        {
            return uDal.Insert(User);
        }
        #endregion

        #region 检测手机号码是否重复---郑同飞
        /// <summary>
        /// 检测手机号码是否重复---郑同飞
        /// </summary>
        /// <param name="tel"></param>
        /// <returns></returns>
        public bool checkPhone(string Phone)
        {
            return uDal.checkPhone(Phone);
        }
        #endregion

        #region 检测用户是否存在---郑同飞
        /// <summary>
        /// 检测用户是否存在---郑同飞
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public bool checkUser(string userName)
        {
            return uDal.checkUser(userName);
        }
        #endregion

        #region 检测邮箱是否存在---郑同飞
        /// <summary>
        /// 检测邮箱是否存在---郑同飞
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public bool checkEmail(string email)
        {
            return uDal.checkEmail(email);
        }
        #endregion

        #region 根据邮箱获得实体---郑同飞
        /// <summary>
        /// 根据email获得实体---ztf
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public User GetModelByEmail(string email) 
        {
            return uDal.GetModelByEmail(email);
        }
        #endregion

        #region 用户分页---郑同飞
        /// <summary>
        /// 用户分页---郑同飞
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="userName"></param>
        /// <param name="email"></param>
        /// <param name="userphone"></param>
        /// <param name="userState"></param>
        /// <returns></returns>
        public DataTable pagingForUser(int pageIndex,int pageSize,string userName,string email,string userphone,string userState)
        {
            return uDal.pagingForUser(pageIndex, pageSize, userName, email, userphone,userState);
        }
        #endregion

        #region 获取用户数量---郑同飞
        /// <summary>
        /// 获取用户数量---郑同飞
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="userEmail"></param>
        /// <param name="userPhone"></param>
        /// <returns></returns>
        public int getRecordCount(string userName,string userEmail,string userPhone) 
        {
            return uDal.getRecordCount(userName, userEmail, userPhone);
        }
        #endregion
    }
}
